<?php
/**
 * Copyright (C) 2013  Artur Tolstenco
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

class SubjectNotPresentException extends Exception {}
class InvalidScopeException extends Exception {}
class InsufficientScopeException extends Exception {}

class QueryParameterNotFoundException extends Exception {}
class DataNotFoundException extends Exception {}

class InvalidDataException extends Exception {}

interface Server_DataServer_ServerInterface {	
	/**
	 * 
	 * @param array $scopes array of string
	 * @param string $subj data owner
	 * 
	 * 
	 * @throws SubjectNotPresentException
	 * @throws InvalidScopeException
	 */
	public function __construct($scopes, $subj);
	
	/**
	 * 
	 * @param array $params key => value parameters
	 * 
	 * @return string representation of requested data
	 * 
	 * 
	 * @throws InsufficientScopeException
	 * @throws QueryParameterNotFoundException
	 * @throws DataNotFoundException
	 * @throws InvalidScopeException
	 */
	public function get($params);
	
	/**
	 * 
	 * @param string $current representation of data to update
	 * @param string $updated representation of updated data
	 * 
	 * 
	 * @throws InsufficientScopeException
	 * @throws InvalidDataException
	 */
	public function update($current, $updated);
	
	/**
	 *
	 * @param string $data representation of data to delete
	 * 
	 * 
	 * @throws InsufficientScopeException
	 * @throws InvalidDataException
	 */
	public function delete($data);
	
	/**
	 * 
	 * @param string $data representation of data to delete
	 * 
	 * 
	 * @throws InsufficientScopeException
	 * @throws InvalidDataException
	 */
	public function write($data);
		
}